/**
 * @author:albert
 */

package com.bkbw.live.battle.business.skill;

import java.lang.reflect.Constructor;
import java.util.HashMap;


public class BuffFactory {
	
	protected HashMap<String, Class> buffLib = new HashMap<String, Class>();
	protected static BuffFactory instance = new BuffFactory();
	
	public static BuffFactory getInstance()
	{
		return instance;
	}
	
	private BuffFactory()
	{
		
	}
	
	public BuffBase createBuff(String buffClass, String buffId, HashMap<String, Object> param)
	{
		BuffBase buff;
		try {
			Class[] paramType = new Class[]{String.class, HashMap.class};
			Constructor constructor = Class.forName(buffClass).getConstructor(paramType);
			
			//Constructor constructor = buffLib.get(buffClass).getConstructor(paramType);
			buff = (BuffBase)constructor.newInstance(buffId, param);
			return buff;
		}
		catch (Exception e) {
			return null;
		}
	}
}
